<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: ConnectionManagerAccess Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00053.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pro-static-attribs">Static Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">ConnectionManagerAccess Class Reference<div class="ingroups"><a class="el" href="a00517.html">connectionManager - channel and connection related classes</a> &#124; <a class="el" href="a00510.html">phyLayer - physical layer modules</a> &#124; <a class="el" href="a00516.html">baseModules - base module classes of MiXiM</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="ConnectionManagerAccess" --><!-- doxytag: inherits="MiximBatteryAccess,AccessModuleWrap" -->
<p>Basic class for all physical layers, please don't touch!!  
 <a href="a00053.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00249_source.html">ConnectionManagerAccess.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ConnectionManagerAccess:</div>
<div class="dyncontent">
<div class="center"><img src="a00651.png" border="0" usemap="#ConnectionManagerAccess_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for ConnectionManagerAccess:</div>
<div class="dyncontent">
<div class="center"><img src="a00652.png" border="0" usemap="#ConnectionManagerAccess_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00653.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac1280a1bba6dd53779bdc69a4cee62ae"></a><!-- doxytag: member="ConnectionManagerAccess::ConnectionManagerAccess" ref="ac1280a1bba6dd53779bdc69a4cee62ae" args="(unsigned sz)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>ConnectionManagerAccess</b> (unsigned sz)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#aad16a20e89c1415737abbebd2d2e4383">initialize</a> (int stage)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Register with <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>.  <a href="#aad16a20e89c1415737abbebd2d2e4383"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a941b21fa937363875b42c0c930aaa58b">receiveSignal</a> (cComponent *source, simsignal_t signalID, cObject *obj)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called by the signalling mechanism to inform of changes.  <a href="#a941b21fa937363875b42c0c930aaa58b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4cb3ab0227b20e7c783416a888daaa02"></a><!-- doxytag: member="ConnectionManagerAccess::getMobilityModule" ref="a4cb3ab0227b20e7c783416a888daaa02" args="()" -->
virtual ChannelMobilityPtrType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a4cb3ab0227b20e7c783416a888daaa02">getMobilityModule</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the host's mobility module. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00019.html">BaseConnectionManager</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a20fd2ed2864836dc4c46a95bb9c3437d">getConnectionManager</a> (const cModule *nic)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> responsible for the passed NIC module.  <a href="#a20fd2ed2864836dc4c46a95bb9c3437d"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049">calculatePropagationDelay</a> (const <a class="el" href="a00159.html">NicEntry</a> *nic)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the propagation delay to the passed receiving nic.  <a href="#a3b29e3e00f660a18c7afa75d129e0049"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a103dd3abe8464c8857991089cbec78ed">sendToChannel</a> (cPacket *msg)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a message to all nics connected to this one.  <a href="#a103dd3abe8464c8857991089cbec78ed"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab62c70bb62f89d8d986db102228b63b7"></a><!-- doxytag: member="ConnectionManagerAccess::getNic" ref="ab62c70bb62f89d8d986db102228b63b7" args="() const " -->
const cModule *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7">getNic</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to nic Module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a359724cad23974a0b9ae4715053bfeb6"></a><!-- doxytag: member="ConnectionManagerAccess::getNic" ref="a359724cad23974a0b9ae4715053bfeb6" args="()" -->
cModule *&#160;</td><td class="memItemRight" valign="bottom"><b>getNic</b> ()</td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa59c873347eaa4bf6120100fc7752055"></a><!-- doxytag: member="ConnectionManagerAccess::useSendDirect" ref="aa59c873347eaa4bf6120100fc7752055" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#aa59c873347eaa4bf6120100fc7752055">useSendDirect</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">use sendDirect or not? <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5a093670c3f1b4f28f3dfbe064616b1b"></a><!-- doxytag: member="ConnectionManagerAccess::cc" ref="a5a093670c3f1b4f28f3dfbe064616b1b" args="" -->
<a class="el" href="a00019.html">BaseConnectionManager</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b">cc</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to the PropagationModel module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a855d05134eb8b4b136aac71480d7a842"></a><!-- doxytag: member="ConnectionManagerAccess::coreDebug" ref="a855d05134eb8b4b136aac71480d7a842" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a855d05134eb8b4b136aac71480d7a842">coreDebug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">debug this core module? <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9b270265a317f2271088e4fd237f36cd"></a><!-- doxytag: member="ConnectionManagerAccess::usePropagationDelay" ref="a9b270265a317f2271088e4fd237f36cd" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a9b270265a317f2271088e4fd237f36cd">usePropagationDelay</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Defines if the physical layer should simulate propagation delay. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ace4348bc0a16695e7555d81064f81c5a"></a><!-- doxytag: member="ConnectionManagerAccess::isRegistered" ref="ace4348bc0a16695e7555d81064f81c5a" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a">isRegistered</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Is this module already registered with <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>? <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-static-attribs"></a>
Static Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2f85f74312468d66a06367bdb769adfd"></a><!-- doxytag: member="ConnectionManagerAccess::mobilityStateChangedSignal" ref="a2f85f74312468d66a06367bdb769adfd" args="" -->
static const <a class="el" href="a00201.html">simsignalwrap_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a2f85f74312468d66a06367bdb769adfd">mobilityStateChangedSignal</a> = <a class="el" href="a00201.html">simsignalwrap_t</a>(MIXIM_SIGNAL_MOBILITY_CHANGE_NAME)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A signal used to subscribe to mobility state changes. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab4120e130c86b7d586d8c5517da72c5b"></a><!-- doxytag: member="ConnectionManagerAccess::ConnectionManagerAccess" ref="ab4120e130c86b7d586d8c5517da72c5b" args="(const ConnectionManagerAccess &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#ab4120e130c86b7d586d8c5517da72c5b">ConnectionManagerAccess</a> (const <a class="el" href="a00053.html">ConnectionManagerAccess</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a388dec50b11a24e08f6bf76c65993a6d"></a><!-- doxytag: member="ConnectionManagerAccess::operator=" ref="a388dec50b11a24e08f6bf76c65993a6d" args="(const ConnectionManagerAccess &amp;)" -->
<a class="el" href="a00053.html">ConnectionManagerAccess</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00053.html#a388dec50b11a24e08f6bf76c65993a6d">operator=</a> (const <a class="el" href="a00053.html">ConnectionManagerAccess</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Basic class for all physical layers, please don't touch!! </p>
<p>This class is not supposed to work on its own, but it contains functions and lists that cooperate with <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> to handle the dynamically created gates. This means EVERY physical layer (the lowest layer in a host) has to be derived from this class!!!!</p>
<p>Please don't touch this class.</p>
<dl class="author"><dt><b>Author:</b></dt><dd>Marc Loebbers </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a3b29e3e00f660a18c7afa75d129e0049"></a><!-- doxytag: member="ConnectionManagerAccess::calculatePropagationDelay" ref="a3b29e3e00f660a18c7afa75d129e0049" args="(const NicEntry *nic)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">simtime_t ConnectionManagerAccess::calculatePropagationDelay </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00159.html">NicEntry</a> *&#160;</td>
          <td class="paramname"><em>nic</em></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Calculates the propagation delay to the passed receiving nic. </p>
<p>claim the Move pattern of the sender from the <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> </p>

<p>References <a class="el" href="a00159.html#a684948749e06f0956cd1ef9fffdedd75">NicEntry::chAccess</a>, <a class="el" href="a00065.html#ab6a7bfcc5c55e5d8edbc7c0cb5a11626">Coord::distance()</a>, <a class="el" href="a00053.html#a4cb3ab0227b20e7c783416a888daaa02">getMobilityModule()</a>, <a class="el" href="a00030.html#a84d040f815027b3098451b02733ac63d">BaseWorldUtility::speedOfLight</a>, and <a class="el" href="a00053.html#a9b270265a317f2271088e4fd237f36cd">usePropagationDelay</a>.</p>

<p>Referenced by <a class="el" href="a00053.html#a103dd3abe8464c8857991089cbec78ed">sendToChannel()</a>.</p>
<div class="fragment"><pre class="fragment">                                                                                {
  <span class="keywordflow">if</span>(!<a class="code" href="a00053.html#a9b270265a317f2271088e4fd237f36cd" title="Defines if the physical layer should simulate propagation delay.">usePropagationDelay</a>)
    <span class="keywordflow">return</span> 0;

  <a class="code" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> *<span class="keyword">const</span> senderModule   = <span class="keyword">this</span>;
  <a class="code" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> *<span class="keyword">const</span> receiverModule = nic-&gt;<a class="code" href="a00159.html#a684948749e06f0956cd1ef9fffdedd75" title="Points to this nics ConnectionManagerAccess module.">chAccess</a>;
  <span class="comment">//const simtime_t_cref sStart         = simTime();</span>

  assert(senderModule);
  assert(receiverModule);

  <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>           sendersPos  = senderModule-&gt;<a class="code" href="a00053.html#a4cb3ab0227b20e7c783416a888daaa02" title="Returns the host&#39;s mobility module.">getMobilityModule</a>()-&gt;getCurrentPosition(<span class="comment">/*sStart*/</span>);
  <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>           receiverPos = receiverModule-&gt;<a class="code" href="a00053.html#a4cb3ab0227b20e7c783416a888daaa02" title="Returns the host&#39;s mobility module.">getMobilityModule</a>()-&gt;getCurrentPosition(<span class="comment">/*sStart*/</span>);

  <span class="comment">// this time-point is used to calculate the distance between sending and receiving host</span>
  <span class="keywordflow">return</span> receiverPos.<a class="code" href="a00065.html#ab6a7bfcc5c55e5d8edbc7c0cb5a11626" title="Returns the distance to Coord &#39;a&#39;.">distance</a>(sendersPos) / <a class="code" href="a00030.html#a84d040f815027b3098451b02733ac63d" title="Speed of light in meters per second.">BaseWorldUtility::speedOfLight</a>;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a20fd2ed2864836dc4c46a95bb9c3437d"></a><!-- doxytag: member="ConnectionManagerAccess::getConnectionManager" ref="a20fd2ed2864836dc4c46a95bb9c3437d" args="(const cModule *nic)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00019.html">BaseConnectionManager</a> * ConnectionManagerAccess::getConnectionManager </td>
          <td>(</td>
          <td class="paramtype">const cModule *&#160;</td>
          <td class="paramname"><em>nic</em></td><td>)</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns a pointer to the <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> responsible for the passed NIC module. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nic</td><td>a pointer to a NIC module </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to a connection manager module or NULL if an error occurred </dd></dl>

<p>Referenced by <a class="el" href="a00053.html#aad16a20e89c1415737abbebd2d2e4383">initialize()</a>.</p>
<div class="fragment"><pre class="fragment">{
  std::string cmName = nic-&gt;hasPar(<span class="stringliteral">&quot;connectionManagerName&quot;</span>)
             ? nic-&gt;par(<span class="stringliteral">&quot;connectionManagerName&quot;</span>).stringValue()
             : <span class="stringliteral">&quot;&quot;</span>;
  <span class="keywordflow">if</span> (cmName != <span class="stringliteral">&quot;&quot;</span>) {
    cModule* ccModule = simulation.getModuleByPath(cmName.c_str());

    <span class="keywordflow">return</span> <span class="keyword">dynamic_cast&lt;</span><a class="code" href="a00019.html" title="Module to control the channel and handle all connection related stuff.">BaseConnectionManager</a> *<span class="keyword">&gt;</span>(ccModule);
  }
  <span class="keywordflow">else</span> {
    <span class="keywordflow">return</span> <a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">FindModule&lt;BaseConnectionManager *&gt;::findGlobalModule</a>();
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="aad16a20e89c1415737abbebd2d2e4383"></a><!-- doxytag: member="ConnectionManagerAccess::initialize" ref="aad16a20e89c1415737abbebd2d2e4383" args="(int stage)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionManagerAccess::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Register with <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>. </p>
<p>Upon initialization <a class="el" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> registers the nic parent module to have all its connections handeled by <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> </p>

<p>Reimplemented from <a class="el" href="a00027.html#a03030e439aaf030c83da6e71e8be2f80">BaseModule</a>.</p>

<p>Reimplemented in <a class="el" href="a00175.html#a0bb0cfac6ebb5459b7480bf9df337a3f">PhyLayerUWBIR</a>, <a class="el" href="a00029.html#a08704deaf03b73c8eda67cc60e670853">BasePhyLayer</a>, <a class="el" href="a00174.html#a815f95ad9fe89412ff3c5991ec1cfafe">PhyLayerBattery</a>, and <a class="el" href="a00190.html#a51d4997ab7973ee4b174ae49fb9b658f">SamplePhyLayer</a>.</p>

<p>References <a class="el" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b">cc</a>, <a class="el" href="a00053.html#a855d05134eb8b4b136aac71480d7a842">coreDebug</a>, <a class="el" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2">BaseModule::findHost()</a>, <a class="el" href="a00053.html#a20fd2ed2864836dc4c46a95bb9c3437d">getConnectionManager()</a>, <a class="el" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7">getNic()</a>, <a class="el" href="a00201.html#aa01f017b96087bc252445206777e0080">simsignalwrap_t::initialize()</a>, <a class="el" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a">isRegistered</a>, <a class="el" href="a00053.html#a2f85f74312468d66a06367bdb769adfd">mobilityStateChangedSignal</a>, and <a class="el" href="a00053.html#a9b270265a317f2271088e4fd237f36cd">usePropagationDelay</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="a00053.html#aad16a20e89c1415737abbebd2d2e4383" title="Register with ConnectionManager.">MiximBatteryAccess::initialize</a>(stage);

    <span class="keywordflow">if</span>( stage == 0 ){
        hasPar(<span class="stringliteral">&quot;coreDebug&quot;</span>) ? <a class="code" href="a00053.html#a855d05134eb8b4b136aac71480d7a842" title="debug this core module?">coreDebug</a> = par(<span class="stringliteral">&quot;coreDebug&quot;</span>).boolValue() : <a class="code" href="a00053.html#a855d05134eb8b4b136aac71480d7a842" title="debug this core module?">coreDebug</a> = <span class="keyword">false</span>;

        <a class="code" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2" title="Function to get a pointer to the host module.">findHost</a>()-&gt;subscribe(<a class="code" href="a00053.html#a2f85f74312468d66a06367bdb769adfd" title="A signal used to subscribe to mobility state changes.">mobilityStateChangedSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>(), <span class="keyword">this</span>);

        <a class="code" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b" title="Pointer to the PropagationModel module.">cc</a> = <a class="code" href="a00053.html#a20fd2ed2864836dc4c46a95bb9c3437d" title="Returns a pointer to the ConnectionManager responsible for the passed NIC module.">getConnectionManager</a>(<a class="code" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7" title="Pointer to nic Module.">getNic</a>());
        <span class="keywordflow">if</span>( <a class="code" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b" title="Pointer to the PropagationModel module.">cc</a> == NULL ) error(<span class="stringliteral">&quot;Could not find ConnectionManager module&quot;</span>);
        <a class="code" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a" title="Is this module already registered with ConnectionManager?">isRegistered</a> = <span class="keyword">false</span>;
    }

    <a class="code" href="a00053.html#a9b270265a317f2271088e4fd237f36cd" title="Defines if the physical layer should simulate propagation delay.">usePropagationDelay</a> = par(<span class="stringliteral">&quot;usePropagationDelay&quot;</span>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a941b21fa937363875b42c0c930aaa58b"></a><!-- doxytag: member="ConnectionManagerAccess::receiveSignal" ref="a941b21fa937363875b42c0c930aaa58b" args="(cComponent *source, simsignal_t signalID, cObject *obj)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionManagerAccess::receiveSignal </td>
          <td>(</td>
          <td class="paramtype">cComponent *&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">simsignal_t&#160;</td>
          <td class="paramname"><em>signalID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">cObject *&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called by the signalling mechanism to inform of changes. </p>
<p><a class="el" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> is subscribed to position changes and informs the <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>. </p>

<p>Reimplemented from <a class="el" href="a00027.html#a9195e1fe5a0ca770e7d29351e0ab2ecf">BaseModule</a>.</p>

<p>References <a class="el" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b">cc</a>, <a class="el" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7">getNic()</a>, <a class="el" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a">isRegistered</a>, <a class="el" href="a00053.html#a2f85f74312468d66a06367bdb769adfd">mobilityStateChangedSignal</a>, <a class="el" href="a00019.html#a2ee333e0335730f5f6bd346d59a9813e">BaseConnectionManager::registerNic()</a>, <a class="el" href="a00019.html#a8dbfe21d2205c13ab6373245dd432353">BaseConnectionManager::updateNicPos()</a>, and <a class="el" href="a00053.html#aa59c873347eaa4bf6120100fc7752055">useSendDirect</a>.</p>
<div class="fragment"><pre class="fragment">{
    <span class="keywordflow">if</span>(signalID == <a class="code" href="a00053.html#a2f85f74312468d66a06367bdb769adfd" title="A signal used to subscribe to mobility state changes.">mobilityStateChangedSignal</a>) {
      ChannelMobilityPtrType <span class="keyword">const</span> mobility = check_and_cast&lt;ChannelMobilityPtrType&gt;(obj);
        <a class="code" href="a00065.html" title="Class for storing 3D coordinates.">Coord</a>                        pos      = mobility-&gt;getCurrentPosition();

        <span class="keywordflow">if</span>(<a class="code" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a" title="Is this module already registered with ConnectionManager?">isRegistered</a>) {
            <a class="code" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b" title="Pointer to the PropagationModel module.">cc</a>-&gt;<a class="code" href="a00019.html#a8dbfe21d2205c13ab6373245dd432353" title="Updates the position information of a registered nic.">updateNicPos</a>(<a class="code" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7" title="Pointer to nic Module.">getNic</a>()-&gt;getId(), &amp;pos);
        }
        <span class="keywordflow">else</span> {
            <span class="comment">// register the nic with ConnectionManager</span>
            <span class="comment">// returns true, if sendDirect is used</span>
            <a class="code" href="a00053.html#aa59c873347eaa4bf6120100fc7752055" title="use sendDirect or not?">useSendDirect</a> = <a class="code" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b" title="Pointer to the PropagationModel module.">cc</a>-&gt;<a class="code" href="a00019.html#a2ee333e0335730f5f6bd346d59a9813e" title="Registers a nic to have its connections managed by ConnectionManager.">registerNic</a>(<a class="code" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7" title="Pointer to nic Module.">getNic</a>(), <span class="keyword">this</span>, &amp;pos);
            <a class="code" href="a00053.html#ace4348bc0a16695e7555d81064f81c5a" title="Is this module already registered with ConnectionManager?">isRegistered</a>  = <span class="keyword">true</span>;
        }
    }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a103dd3abe8464c8857991089cbec78ed"></a><!-- doxytag: member="ConnectionManagerAccess::sendToChannel" ref="a103dd3abe8464c8857991089cbec78ed" args="(cPacket *msg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ConnectionManagerAccess::sendToChannel </td>
          <td>(</td>
          <td class="paramtype">cPacket *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sends a message to all nics connected to this one. </p>
<p>This function has to be called whenever a packet is supposed to be sent to the channel. Don't try to figure out what gates you have and which ones are connected, this function does this for you!</p>
<p>depending on which <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> module is used, the messages are send via sendDirect() or to the respective gates. </p>

<p>References <a class="el" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049">calculatePropagationDelay()</a>, <a class="el" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b">cc</a>, <a class="el" href="a00019.html#a0d0325d9aee770539d802b878ebf32cf">BaseConnectionManager::getGateList()</a>, <a class="el" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7">getNic()</a>, and <a class="el" href="a00053.html#aa59c873347eaa4bf6120100fc7752055">useSendDirect</a>.</p>

<p>Referenced by <a class="el" href="a00029.html#aaf9ded47fad2c0930aee595b9ec16770">BasePhyLayer::sendMessageDown()</a>.</p>
<div class="fragment"><pre class="fragment">{
    <span class="keyword">const</span> <a class="code" href="a00159.html#a209882de7781ff52db0ae559c1654e08" title="Type for map from NicEntry pointer to a gate.">NicEntry::GateList</a>&amp; gateList = <a class="code" href="a00053.html#a5a093670c3f1b4f28f3dfbe064616b1b" title="Pointer to the PropagationModel module.">cc</a>-&gt;<a class="code" href="a00019.html#a0d0325d9aee770539d802b878ebf32cf" title="Returns the ingates of all nics in range.">getGateList</a>( <a class="code" href="a00053.html#ab62c70bb62f89d8d986db102228b63b7" title="Pointer to nic Module.">getNic</a>()-&gt;getId());
    NicEntry::GateList::const_iterator i = gateList.begin();

    <span class="keywordflow">if</span>(<a class="code" href="a00053.html#aa59c873347eaa4bf6120100fc7752055" title="use sendDirect or not?">useSendDirect</a>){
        <span class="comment">// use Andras stuff</span>
        <span class="keywordflow">if</span>( i != gateList.end() ){
          simtime_t delay = SIMTIME_ZERO;
            <span class="keywordflow">for</span>(; i != --gateList.end(); ++i){
              <span class="comment">//calculate delay (Propagation) to this receiving nic</span>
              delay = <a class="code" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049" title="Calculates the propagation delay to the passed receiving nic.">calculatePropagationDelay</a>(i-&gt;first);

                <span class="keywordtype">int</span> radioStart = i-&gt;second-&gt;getId();
                <span class="keywordtype">int</span> radioEnd = radioStart + i-&gt;second-&gt;size();
                <span class="keywordflow">for</span> (<span class="keywordtype">int</span> g = radioStart; g != radioEnd; ++g)
                    sendDirect(static_cast&lt;cPacket*&gt;(msg-&gt;dup()),
                               delay, msg-&gt;getDuration(), i-&gt;second-&gt;getOwnerModule(), g);
            }
            <span class="comment">//calculate delay (Propagation) to this receiving nic</span>
      delay = <a class="code" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049" title="Calculates the propagation delay to the passed receiving nic.">calculatePropagationDelay</a>(i-&gt;first);

            <span class="keywordtype">int</span> radioStart = i-&gt;second-&gt;getId();
            <span class="keywordtype">int</span> radioEnd = radioStart + i-&gt;second-&gt;size();
            <span class="keywordflow">for</span> (<span class="keywordtype">int</span> g = radioStart; g != --radioEnd; ++g)
                sendDirect(static_cast&lt;cPacket*&gt;(msg-&gt;dup()),
                           delay, msg-&gt;getDuration(), i-&gt;second-&gt;getOwnerModule(), g);

            sendDirect(msg, delay, msg-&gt;getDuration(), i-&gt;second-&gt;getOwnerModule(), radioEnd);
        }
        <span class="keywordflow">else</span>{
            coreEV &lt;&lt; <span class="stringliteral">&quot;Nic is not connected to any gates!&quot;</span> &lt;&lt; endl;
            <span class="keyword">delete</span> msg;
        }
    }
    <span class="keywordflow">else</span>{
        <span class="comment">// use our stuff</span>
        coreEV &lt;&lt;<span class="stringliteral">&quot;sendToChannel: sending to gates\n&quot;</span>;
        <span class="keywordflow">if</span>( i != gateList.end() ){
          simtime_t delay = SIMTIME_ZERO;
            <span class="keywordflow">for</span>(; i != --gateList.end(); ++i){
              <span class="comment">//calculate delay (Propagation) to this receiving nic</span>
        delay = <a class="code" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049" title="Calculates the propagation delay to the passed receiving nic.">calculatePropagationDelay</a>(i-&gt;first);

                sendDelayed( static_cast&lt;cPacket*&gt;(msg-&gt;dup()),
                             delay, i-&gt;second );
            }
            <span class="comment">//calculate delay (Propagation) to this receiving nic</span>
      delay = <a class="code" href="a00053.html#a3b29e3e00f660a18c7afa75d129e0049" title="Calculates the propagation delay to the passed receiving nic.">calculatePropagationDelay</a>(i-&gt;first);

            sendDelayed( msg, delay, i-&gt;second );
        }
        <span class="keywordflow">else</span>{
            coreEV &lt;&lt; <span class="stringliteral">&quot;Nic is not connected to any gates!&quot;</span> &lt;&lt; endl;
            <span class="keyword">delete</span> msg;
        }
    }
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/connectionManager/<a class="el" href="a00249_source.html">ConnectionManagerAccess.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/connectionManager/ConnectionManagerAccess.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00053.html">ConnectionManagerAccess</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
